﻿
using OpenCvSharp;

using Xc.DataAccess.Core;

namespace Xc.DataAccess.CodeReader.Models.Filters
{
    [Filter("绘制实心圆",FilterType.Draw)]
    public class DrawFilledCircle:FilterBase
    {
        /// <summary>
        /// 原点
        /// </summary>
        [InputParameter("原点")]
        public CVPoint Center { get; set; } = new CVPoint();
        /// <summary>
        /// 半径
        /// </summary>
        [InputParameter("半径")]
        public int Radius { get; set; }
        /// <summary>
        /// 颜色
        /// </summary>
        [InputParameter("颜色")]
        public Scalar Color { get; set; }
        /// <summary>
        /// 偏移量
        /// </summary>
        [InputParameter("缩放值", ParameterType.Optional)]
        public int Shift { get; set; } = 0;
        /// <summary>
        /// 线段类型
        /// </summary>
        [InputParameter("线段类型", ParameterType.Optional)]
        public LineTypes LineType { get; set; }
        DrawCircle drawCircle;
        internal override ResultData<Mat> UseChannel(Mat mat, FilterBase[] filterInfos, FilterBase preFilterBase)
        {
            if (drawCircle==null)
            {
                drawCircle = new DrawCircle();
            }
            drawCircle.Thickness = -1;
            drawCircle.LineType = LineType;
            drawCircle.Color = Color;
            drawCircle.Radius = Radius; 
            drawCircle.Center = Center; 
            drawCircle.Shift = Shift;
            return drawCircle.UseChannel(mat,filterInfos,preFilterBase);
        }
    }
}
